package com.activenetwork.smlite.testcase.login;

import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import com.activenetwork.custom.uielement.decorate.IdentifierFactory;
import com.activenetwork.smlite.testcase.BaseCase;
import com.activenetwork.util.EnvContext;
import com.activenetwork.util.verification.VerificationAction;
import com.activenetwork.util.verification.gson.FailurePoint;

public class Login006 extends BaseCase {
	static final Logger logger = LoggerFactory.getLogger(Login006.class);
	
	@Test
	public void Check_Password_will_be_encrpted_after_typing(){
		
		// Check the password input field tag and attribute
		loginBusiness.login(new VerificationAction(){
			@Override
			public void verify() {				
				WebElement element = IdentifierFactory.createWebElement("LoginPage", "UserPassword");
				
				if(!StringUtils.equalsIgnoreCase("input", element.getTagName())){
					EnvContext.failurePointTL.get().add(new FailurePoint(
							Login006.class.getName(), 
							"Verify user password is a input tag", 
							"User password is not a input tag. Not Correct."));
				}
				
				if(!StringUtils.equalsIgnoreCase("password", element.getAttribute("type"))){
					EnvContext.failurePointTL.get().add(new FailurePoint(
							Login006.class.getName(), 
							"Verify user password is a password input", 
							"User password is not a password input. Not correct."));
				}
				
				if(!StringUtils.equalsIgnoreCase("off", element.getAttribute("autocomplete"))){
					EnvContext.failurePointTL.get().add(new FailurePoint(
							Login006.class.getName(), 
							"Verify user password is not auto-complete", 
							"User password is an auto-complete field. Not correct."));
				}
				
			
				if(!StringUtils.equalsIgnoreCase("50", element.getAttribute("maxlength"))){
					EnvContext.failurePointTL.get().add(new FailurePoint(
							Login006.class.getName(), 
							"Verify user password is 50 chars length", 
							"User password is not 50 chars length. Not correct."));
				}
				
				if(!StringUtils.equalsIgnoreCase("40", element.getAttribute("size"))){
					EnvContext.failurePointTL.get().add(new FailurePoint(
							Login006.class.getName(), 
							"Verify user password is 40 input size", 
							"User password is not 40 input size. Not correct."));
				}
			}
		});
		
		loginBusiness.logout();
	}
	
 
	
	
}
